<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/view/include/inc.jsp"%>
<!DOCTYPE html >
<html>
<head>
<%@ include file="/WEB-INF/view/include/jQgrid.jsp"%>

</head>
<body style="background-color: white;" class="gray-bg">
	<div class="ibox-content">
		<form class="form-horizontal m-t" id="signupForm" method="post" >
		<input name ="id" type="hidden" value="${industry.id }">
		<input name ="level" type="hidden" value="${industry.level }">
			<div class="form-group">
				<label class="col-sm-3 control-label">职能名称：</label>
				<div class="col-sm-8">
					<input id="title" name="name" class="form-control" type="text" value="${industry.name }">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">排序：</label>
				<div class="col-sm-8">
					<input id="sort" name="sort" class="form-control" type="text" value="${industry.sort }">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">说明：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" class="form-control" type="text" value="${industry.remark }">
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-8 col-sm-offset-3">
					<button class="btn btn-primary" type="button" id="submit">提交</button>
				</div>
			</div>
		</form>
	</div>


	<script>
	$(function(){
		$("#submit").click(function(){
			var name = $("#title").val();
			if(name.length==0){
				$("#title").tips({
					side:3,
		            msg:'行业名称不能为空！',
		            bg:'#AE81FF',
		            time:1
		        });
				$("#title").focus();
				return;
			}
			$("#signupForm").ajaxSubmit({
	        	url:'<%=contextPath %>/industry/update',
	        	dataType:"json",
	        	success:function(data){
	        		if(data.code==200){
	        			swal({
	        			    title: data.message,
	        			    type: "success",
	        			    showCancelButton: false,
	        			    confirmButtonText: "确定",
	        			    animation:"slide-from-bottom",
	        			    closeOnConfirm: true
	        			},function(){
	        				top.Dialog.close();
	        			});
	        		}else{
	        			swal("错误", data.message, "error");
	        		}
	        	}
	      }); 
	   });
	});
	</script>
</body>
</html>